package com.eastfair.venuebooking.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 场地分类表
 * </p>
 *
 * @author linan
 * @date 2023-03-29
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "SpaceCategorySpaceTypeEnum", description = "场地类型 #{EXHIBITION_HALL:展厅;CONFERENCE_ROOM:会议室;ADVERTISING_SPACE:广告位-枚举")
public enum SpaceCategorySpaceTypeEnum implements BaseEnum {

    /**
     * EXHIBITION_HALL="展厅"
     */
    EXHIBITION_HALL("展厅"),
    /**
     * CONFERENCE_ROOM="会议室"
     */
    CONFERENCE_ROOM("会议室"),
    /**
     * ADVERTISING_SPACE="广告位"
     */
    ADVERTISING_SPACE("广告位"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static SpaceCategorySpaceTypeEnum match(String val, SpaceCategorySpaceTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static SpaceCategorySpaceTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(SpaceCategorySpaceTypeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "EXHIBITION_HALL,CONFERENCE_ROOM,ADVERTISING_SPACE", example = "EXHIBITION_HALL")
    public String getCode() {
        return this.name();
    }

}
